<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        if (true) {
            // TDZ开始
            tmp = 'abc'; // ReferenceError
            console.log(tmp); // ReferenceError

            let tmp; // TDZ结束
            console.log(tmp); // undefined

            tmp = 123;
            console.log(tmp); // 123
        }

        //上面代码中，在let命令声明变量tmp之前，都属于变量tmp的“死区”。
    </script>
</body>

</html>